import math
import random

x = 3
x = 'abcde'
x = 0xad
math.pi
x = random.randint(10, 20)
# a, b = input().split(',')
# b = int(b)
# c = int(a, b)
# print(c)
# x = int(input())
# if x == 0:
#     result = 0
# else:
#     result = 1 / x
# print('f({0:.1f}) = {1:.1f}'.format(x, result))
# list1 = [1, 2, 3, 'a']
# a = '35'
# a = float(a)
# print(a)
# a = 3 + 1j
# # b = 3 + j error
# print(a)
# x = 7
# y = 8
# x, y = y, x
# print(x)
# print(y)
# print('a' + 1) # error
# print(5.0/2.0)
# print(5 // 2.0)
# print(5.0 // 2.0)
# print(bool(None))
# print(bool(0))
# print(bool(1))
# print(bool(()))
# print(type(0))
# print(type(-99))
# print(type('1000'))
# x, y = 1010, 0b1010
# n = str(x) + str(y)
# print(n)
# a = complex(4, 5)
# print(a.imag)
# a = 4 + 3J
# print(abs(a))
# print(False + False)
# print(False or True)
# print(2 + 3 == 4 or 5 >= 5)
# print(not(2 + 3 == 4 or 5 >= 5))
# print(int(5.6))
# print(10 and 5)
# print(32.2//6 - 24//6)
# print(3 and 0 and 5)
# x = 9
# x %= 5
# print(x)

# n = int('0x8F', 16)
# print(bin(n))
# print('Hello' < 'world')
# n = math.sqrt(math.pow(math.pi, 2) + 3)
# print(n)

# h = eval(input())
# r = eval(input())
# print("{:.2f}".format(math.pow(r, 2) * math.pi * h))
# print("{:.2f}".format(2 * math.pi * r * h + math.pow(r, 2) * math.pi))

fh = int(input())
mh = int(input())
sex = str(input())
if(sex == '女') :
    gh = int((fh * 0.923 + mh) / 2)
    print(gh)
elif(sex == '男'):
    bh = int((fh + mh) * 1.08 / 2)
    print(bh)
else:
    print('无对应公式')